
<?php

use yii\helpers\Html;
use yii\widgets\LinkPager;
$this->title='A-PMS项目管理系统-完善信息';
$this->registerCssFile('@web/css/index.css', ['depends' => ['backend\assets\AppAsset'], 'position' => $this::POS_HEAD]);
$this->registerCssFile('@web/css/notEdit.css', ['depends' => ['backend\assets\AppAsset'], 'position' => $this::POS_HEAD]);
$this->registerCssFile('@web/css/select2.min.css', ['depends' => ['backend\assets\AppAsset'], 'position' => $this::POS_HEAD]);


$this->registerCss('  
    #projectlist tbody tr td select{display : block; margin:0 auto;}
    .projectList table{font-size : 14px; }
    .projectList table tbody{color : #333; }
    .projectList .pagination  {margin : 20px 25%;} 
');
?>
<!-- 主体部分   开始 -->
<!--	<div class="container-fluid">-->
<!--		<div class="container content">-->
<div class="row">
    <!-- 左侧边栏 -->
    <!--<div class="content-left pull-left col-md-2">
        <div class="list-group ">
          <a href="#" class="list-group-item active">
            <img src="/image/officeHall/uploadAssetPackage/upload.png" class="pull-left"><span>上传基本信息</span>
          </a>
          <a href="#" class="list-group-item">
              <img src="/image/officeHall/uploadAssetPackage/new.png" class="pull-left"><span>我的新建记录</span></a>
        </div>

    </div>	-->
    <!-- 右侧边栏 -->
    <div class="content-right pull-right row col-md-12">
        <!-- 1. 完善信息一栏-->
        <div class="perfect-information row container-fluid mb10 clearfix">
            <?php
            echo $this->render('edit-base-perfect',['data'=>$data]);//资产包详细信息
            ?>
        </div>
        <!-- 1.完善信息 结束 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
        <!-- 2.转让信息 开始 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
        <div class="Transfer-information container-fluid row mb10">
            <?php
            echo $this->render('edit-transfer-detail',['data'=>$data]);//资产包转让信息
            ?>
        </div>
        <!-- 2.转让信息 结束 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
        <!-- 3.养护    开始  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
        <div class="History-information maintenance row mb10">
            <?php
            echo $this->render('edit-history-detail',['data'=>$data]);//资产包前期流转历史记录
            ?>
        </div>

        <!-- 3.养护       结束  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
        <!-- 4.项目清单    开始  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
        <div class="projectList row">
            <form class="" id="projectListForm">
                <div class="perfect-logo">
                    <img src="/image/officeHall/uploadAssetPackage/wsxx.png" class="pull-left">
                    <span class="pull-left">项目清单</span>
                </div>

                <div class="table-responsive pull-left" style="margin-bottom: 20px;">
                    <table class="table" id="projectlist">
                        <thead>
                        <tr>
                            <th class="text-center" width="45">序号</th>
                            <th class="text-left">借款人名称</th>
                            <th class="text-left">本金</th>
                            <th class="text-left">利息</th>
                            <th class="text-left">本息合计</th>
                            <th class="text-center">诉讼状态</th>
                            <th class="text-left">保证人/抵押人</th>
                            <th class="text-left">担保方式</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?PHP
                        $i=1;
                        $delbut='';//删除按钮的list
                        // var_dump($data['projectlist']);
                        foreach($data['projectlist'] as $val){
                            switch ($val['is_suit'])
                            {
                                case 2:
                                    $foneS='';
                                    $zeroS='';
                                    $oneS='';
                                    $twoS='selected = "selected"';
                                    break;
                                case 1:
                                    $foneS='';
                                    $zeroS='';
                                    $oneS='selected = "selected"';
                                    $twoS='';
                                    break;
                                case 0:
                                    $foneS='';
                                    $zeroS='selected = "selected"';
                                    $oneS='';
                                    $twoS='';
                                    break;
                                default:
                                    $foneS='selected = "selected"';
                                    $zeroS='';
                                    $oneS='';
                                    $twoS='';
                            }
                            $is_suit='<select name="is_suit'.$val['id'].'">
                                                      <option value="-1" '.$foneS.'>无</option>
                                                      <option value="0" '.$zeroS.'>未诉</option>
                                                      <option value="1" '.$oneS.'>已诉</option>
                                                      <option value="2" '.$twoS.'>部分诉讼</option>
                                                    </select>';
                            echo '<tr class="text-left" id="projectTr'.$val['id'].'">
                                                        <td class="text-center">'.$i.'</td>
                                                        <td><input type="text" name="borrower'.$val['id'].'" value="'.$val['borrower'].'"></td>
                                                        <td><input type="text" name="principal'.$val['id'].'" value="'.Yii::$app->formatter->asDecimal($val['principal']).'"></td>
                                                        <td><input type="text" name="interest'.$val['id'].'" value="'.Yii::$app->formatter->asDecimal($val['interest']).'"></td>
                                                        <td><input type="text" name="benxi'.$val['id'].'" value="'.Yii::$app->formatter->asDecimal($val['principal']+$val['interest']).'"></td>
                                                        <td>'.$is_suit.'</td>
                                                        <td><input type="text" name="guarantor'.$val['id'].'" value="'.$val['guarantor'].'"></td>
                                                        <td><input type="text" name="warranty'.$val['id'].'" value="'.$val['warranty'].'"></td>
                                                    </tr>';
                            //<td><input type="text" name="is_suit'.$val['id'].'" value="'.$val['is_suit'].'"></td>
                            $delbut.='<li projectid="'.$val['id'].'" ></li>';
                            $i++;
                        }
                        ?>

                        </tbody>
                    </table>
                </div>
                <!-- 增删按钮 -->
                <ul class="table-addpop pull-left" id="delproject">
                    <?php echo $delbut; ?>
                </ul>
                <!-- 表格结束 -->
                <!-- 分页 -->
                <?PHP
                echo LinkPager::widget([
                    'pagination' => $pages,
                    'firstPageLabel' => '首页',
                    'lastPageLabel' => '尾页',
                    'nextPageLabel' => '下一页',
                    'prevPageLabel' => '上一页'
                ]);
                ?>
                <!-- 结束按钮 -->
                <div class=" btns" >
                    <button type="button" class="maintenance-btn-sav btn btn-primary btns-primary-save pull-right btns-primary projectList-btn"  id="projectSubmit">提交</button>
                    <button type="button" class="maintenance-btn-del btn btn-default btns-primary-del pull-right btns-primary projectList-btn" onclick="window.history.back();">上一步</button>
                </div>
            </form>
            <script type="text/javascript">
                $(".pagination a").click(function (e) {
                    e.preventDefault();
                    var url=$(this).attr('href');
                    $.get(url,function(msg){
                        //alert(msg);
                        $('.projectList').html(msg);
                    })

                });
            </script>
        </div>
        <!-- 4.项目清单   结束  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
    </div>
</div>


<!-- textarea 高度设置对比div -->
<div style="max-height: 1px; overflow: hidden;">
    <div id="d1" style="visibility:hidden" class="one-txt-cut"></div>
</div>
<!--		</div>-->
<!--	</div>-->
<?php

//$this->registerJsFile('@web/js/common.js',['depends'=>['backend\assets\AppAsset'],'position'=>$this::POS_END]);
//$this->registerJsFile('@web/js/index.js',['depends'=>['backend\assets\AppAsset'],'position'=>$this::POS_END]);
//$this->registerJsFile('@web/js/packageinfo.js',['depends'=>['backend\assets\AppAsset'],'position'=>$this::POS_END]);
?>

<script type="text/javascript" src="/js/common.js" ></script>
<script type="text/javascript" src="/js/index.js"></script>
<script type="text/javascript" src="/js/packageinfo.js"></script>
<script type="text/javascript" src="/js/jquery.validate.min.js"></script>
<script type="text/javascript" src="/js/jquery.validate.extend.js"></script>
<script type="text/javascript" src="/js/messages_zh.js"></script>
<script type="text/javascript" src="/js/select2.min.js"></script>
<script type="text/javascript">
    $(function(){
        $("#infoForm").validate();
        $("#transferForm").validate();
    });
</script>
<script type="text/javascript">
    $(function(){
        $("#projectlist").find("a").addClass("txt-cut");
        $("#projectlist").find("span").addClass("txt-cut");
        $("#projectlist").find("input").addClass("txt-cut");
        $("#projectlist").find("input").blur(function(){
            $(this).css("border","none");
        });
    });
</script>
